<template>
	<view class="box">
		<map class="map" :latitude="latitude" :longitude="longitude" :markers="covers"></map>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				latitude: 39.909,
				longitude: 116.39742,
			}
		},
		computed:{
			covers(){
				return [{
					latitude:this.latitude,
					longitude:this.longitude,
					width:20,
					height:20,
					iconPath:"../../static/logo.png"
				}]
			}
		},
		onLoad(){
			this.getUserLocation();
		},
		methods: {
			getUserLocation(){
				uni.getLocation({
					type:'gcj02',
					success:(res) => {
						console.log(res)
						this.latitude = res.latitude;
						this.longitude = res.longitude;
					}
				})
			}
		}
	}
</script>

<style scoped>
.box{
	width: 750rpx;
	height: 100vh;
}
.map{
	width: 100%;
	height: 100%;
}
</style>
